<html>
<body>
<pre>
<?php
	// fshlGenerator class example
	//
	// SECURITY WARNING:
	// Don't use this dangerous script in your live webs!
	//
	include ('fshl/fshl-generator.php');
	
	$languages = array(
	
				"RUBY",
				"PHP",
				"HTML",
				"HTMLonly",
				"CSS",
				"JAVA",
				"JS",
				"CPP",
				"TXT",
				//TODO: add your new languages here
				);
	$errors=0;
	$touch=false;
	foreach($languages as $lang)
	{
		$lang_file = $lang.'_lang.php';
		$update_file = true;
		if(file_exists(FSHL_CACHE.$lang_file)) {
			// update cache, when source language is newer than cached, or generator was changed
			$update_file = 	(filemtime(FSHL_LANG.$lang_file) > filemtime(FSHL_CACHE.$lang_file)) ||
							(filemtime(FSHL_CACHE.$lang_file) < filemtime(FSHL_PATH.'fshl-generator.php'));
		}
		if($update_file) {
				echo "- Updating <b>$lang</b> language -\n";
				$fgen = new fshlGenerator($lang);
				$fgen->write();
				$errors += $fgen->is_error();
				$touch = true;
			} else {
				echo "- Language <b>$lang</b> without changes -\n";
			}
	}
	if($errors) {
		echo "\nThere are <b>$errors</b> error(s).\n";
	} else {
		echo "\nUpdate OK.\n";
	}
	if($touch) {
		touch(FSHL_CACHE.'.touch');
	}
?>
</pre>
</body>
</html>
